package com.example.mq.consumer;
import com.example.dto.CashOutMsg;
import com.example.mq.dto.Msg;
import com.example.mq.po.MsgConsumePO;
import com.example.service.CashOutService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/*
@description:
@ClassName CashOutMsgConsumer
@author chen
@create 2025-08-29 17:15
@Version 1.0
*/
@Component
@Slf4j
public class CashOutMsgConsumer extends AbstractRetryConsumer<CashOutMsg, Msg<CashOutMsg>>
{
    @Autowired
    private CashOutService cashOutService;


    @RabbitListener(queues = "cashOutQueue")
    public void dispose(Message message)
    {
        super.dispose(message);
    }


    @Override
    protected void consume(Message message, Msg<CashOutMsg> msg, MsgConsumePO msgConsumerPO)
    {
        CashOutMsg cashOutMsg = msg.getBody();
        //处理提现消息
        this.cashOutService.disposeCashOutMsg(cashOutMsg);
    }
}
